package com.rabincorp.euro2012.service.setup;

import javax.persistence.EntityManager;

import com.rabincorp.euro2012.entity.Group;
import com.rabincorp.euro2012.support.HttpMethod;
import com.rabincorp.euro2012.support.Service;
import com.rabincorp.euro2012.support.ServiceConfig;
import com.rabincorp.euro2012.support.ServiceContext;

@ServiceConfig(path = "setup", method = HttpMethod.GET)
public class Setup implements Service{

	@Override
	public String serve(ServiceContext ctx) throws Exception {
		EntityManager em = ctx.getEntityManager();
		
		//create group, team
		Group groupA = new Group("Group A");
		groupA.addTeam("Poland", "POL");
		groupA.addTeam("Greece", "GRE");
		groupA.addTeam("Russia", "RUS");
		groupA.addTeam("Czech Republic", "CEZ");
		
		Group groupB = new Group("Group B");
		groupB.addTeam("Netherland", "NED");
		groupB.addTeam("Denmark", "DEN");
		groupB.addTeam("Germany", "GER");
		groupB.addTeam("Portugal", "POR");		
		
		Group groupC = new Group("Group C");
		groupC.addTeam("Spain", "ESP");
		groupC.addTeam("Italy", "ITA");
		groupC.addTeam("Republic of Ireland", "IRL");
		groupC.addTeam("Croatia", "CRO");
		
		Group groupD = new Group("Groupd D");
		groupD.addTeam("Ukraine", "UKR");
		groupD.addTeam("Sweden", "SWE");
		groupD.addTeam("France", "FRA");
		groupD.addTeam("England", "EN");
		
		return null;
	}

}
